<script type="text/javascript">
$(function() {
	$.ajax({
		type: 'GET',
		url:"applicationSingle/getCardInfo",
		dataType:"json",
		async: false,
		success:function(data){
			if(data.statusCode==DWZ.statusCode.error){
				navTabAjaxDone(data)
				return;
			}
			var content="<option value='' selected>请选择</option>";
			$(data).each(function(n,item){
				for(var i=0;i<item.certificates.length;i++){
					content+="<option value="+item.certificates[i].certificateType+">"
					+item.certificates[i].certificatesName+"</option>"
				}
				$("#paperTypeByUpdatePersonalReg").html(content);
				$.ajax({
					type: 'POST',
					url:"personalInfo/getPersonalInfo",
					dataType:"json",
					async: false,
					success: function(json){
						if(json!=null){						
							$("input[name='customerNo']").val(json.customerNo)
							$("input[name='customerName']").val(json.customerName)
							if(json.gender=="01"){
								$("input[value='01']").attr("checked",true)
							}
							if(json.gender=="02"){
								$("input[value='02']").attr("checked",true)
							}
							$("#paperTypeByUpdatePersonalReg").val(json.paperType)
							$("input[name='birth']").val(getDate(json.birthday))
							$("input[name='paperNo']").val(json.paperNo)
							$("input[name='mobile']").val(json.mobile)
							$("input[name='curAddrDetailedInfo']").val(json.curAddrDetailedInfo==null?"":json.curAddrDetailedInfo)
							$("input[name='homePhone']").val(json.homePhone==null?"":json.homePhone)
							$("input[name='contactPostalcode']").val(json.contactPostalcode==null?"":json.contactPostalcode)
							$("input[name='email']").val(json.email==null?"":json.email)
							nationality=json.nationality;
							prAddrProvince=json.prAddrProvince;
							prAddrCity=json.prAddrCity;
							curAddrProvince=json.curAddrProvince;
							curAddrCity=json.curAddrCity;
							curAddrCounty=json.curAddrCounty;
							curAddrStreet=json.curAddrStreet;
							$("#submitByUpdatePersonal").attr("disabled",true);
						}
					},
					error: DWZ.ajaxError
				})
				
			});
		},
		error: DWZ.ajaxError
	})
	
	$.get("applicationSingle/pro",function(data){
		var contenta="";		
		var i;
		$(data).each(function(n,item){
              for(i=0;i<item.AddressProvince.length;i++){
              	if(item.AddressProvince[i].province==curAddrProvince){
              		contenta+="<option value="+item.AddressProvince[i].provinceid+" selected>"
      				+item.AddressProvince[i].province+"</option>"
              	}else{
              		contenta+="<option value="+item.AddressProvince[i].provinceid+"> "
      				+item.AddressProvince[i].province+"</option>"
              	}
		}
        $("select[name='prAddrProvince1']").html(contenta);
  		$("select[name='curAddrProvince1']").html(contenta);
  		$("select[name='contactAddrProvince1']").html(contenta);
		changepro();
		changepro1();
		changepro2()
		});
	},"json");
	
	$.get("applicationSingle/nation",function(data){
		var contenta="<option value='' selected>请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.Nation.length;i++){
                	if(item.Nation[i].numbercode==nationality){
                		contenta+="<option value="+item.Nation[i].numbercode+" selected='selected'>"
        				+item.Nation[i].nationname+"</option>"
        				continue;
                	}
					contenta+="<option value="+item.Nation[i].numbercode+">"
								+item.Nation[i].nationname+"</option>"
			}
			$("#nationality").html(contenta);
	
			
		});
	},"json");
	
})
		
function changepro(){
	var selecttext=$("select[name='prAddrProvince1']").find("option:selected").text();
	var selectId=$("select[name='prAddrProvince1']").val();
	$("input[name='praddrProvince']").val(selecttext);
	$.post("applicationSingle/city",{selectId:selectId},function(data){
		var contenta="<option value=''>请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressCity.length;i++){
                	if(item.AddressCity[i].city==curAddrCity){
                		contenta+="<option value="+item.AddressCity[i].cityid+" selected>"
						+item.AddressCity[i].city+"</option>"
                	}else{
                		contenta+="<option value="+item.AddressCity[i].cityid+">"
						+item.AddressCity[i].city+"</option>"
                	}
					
			}
			$("select[name='prAddrCity1']").html(contenta);
			changecitys();
		});
	},"json");
		
}
function changepro1(){
	var selectId=$("select[name='curAddrProvince1']").val();
	var selecttext=$("select[name='curAddrProvince1']").find("option:selected").text(); 
	$("input[name='curAddrProvince']").val(selecttext);
	$.post("applicationSingle/city",{selectId:selectId},function(data){
		var contenta="<option value='' >请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressCity.length;i++){
                	if(item.AddressCity[i].city==curAddrCity){
                		contenta+="<option value="+item.AddressCity[i].cityid+" selected >"
        				+item.AddressCity[i].city+"</option>"
                	}else{
                		contenta+="<option value="+item.AddressCity[i].cityid+">"
        				+item.AddressCity[i].city+"</option>"
                	}	
			}
			$("select[name='curAddrCity1']").html(contenta);
			changecity();
		});
	},"json");
}	
function changepro2(){
	var selectId=$("select[name='contactAddrProvince1']").val();
	var selecttext=$("select[name='contactAddrProvince1']").find("option:selected").text(); 
	$("input[name='contactAddrProvince']").val(selecttext);
	$.post("applicationSingle/city",{selectId:selectId},function(data){
		var contenta="<option value='' >请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressCity.length;i++){
                	if(item.AddressCity[i].city==curAddrCity){
                		contenta+="<option value="+item.AddressCity[i].cityid+" selected >"
        				+item.AddressCity[i].city+"</option>"
                	}else{
                		contenta+="<option value="+item.AddressCity[i].cityid+">"
        				+item.AddressCity[i].city+"</option>"
                	}
				
			}
			$("select[name='contactAddrCity1']").html(contenta);
			changecity1();
		});
	},"json");
}
function changecitys(){
	var selecttext=$("select[name='prAddrCity1']").find("option:selected").text(); 
	$("input[name='prAddrCity']").val(selecttext);
}
function changecity(){
	var selectId=$("select[name='curAddrCity1']").val();
	if(selectId==null || selectId==""){
		return false;
	}
	var selecttext=$("select[name='curAddrCity1']").find("option:selected").text(); 
	$("input[name='curAddrCity']").val(selecttext);
	$.post("applicationSingle/county",{selectId:selectId},function(data){
		var contenta="<option value='' >请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressArea.length;i++){
                	if(item.AddressArea[i].area==curAddrCounty){
                		contenta+="<option value="+item.AddressArea[i].areaid+" selected >"
        				+item.AddressArea[i].area+"</option>"
                	}else{
                		contenta+="<option value="+item.AddressArea[i].areaid+">"
        				+item.AddressArea[i].area+"</option>"
                	}
				
			}
			$("select[name='curAddrCounty1']").html(contenta);
			changecounty();
		});
	},"json");
}
function changecity1(){
	var selectId=$("select[name='contactAddrCity1']").val();
	if(selectId==null || selectId==""){
		return false;
	}
	var selecttext=$("select[name='contactAddrCity1']").find("option:selected").text(); 
	$("input[name='contactAddrCity']").val(selecttext);
	$.post("applicationSingle/county",{selectId:selectId},function(data){
		var contenta="<option value='' >请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressArea.length;i++){
                	if(item.AddressArea[i].area==curAddrCounty){
                		contenta+="<option value="+item.AddressArea[i].areaid+" selected >"
        				+item.AddressArea[i].area+"</option>"
                	}else{
                		contenta+="<option value="+item.AddressArea[i].areaid+">"
        				+item.AddressArea[i].area+"</option>"
                	}
				
			}
			$("select[name='contactAddrCounty1']").html(contenta);
			changecounty1();
		});
	},"json");
}
function changecounty(){
	var selectId=$("select[name='curAddrCounty1']").val();
	if(selectId==null || selectId==""){
		return false;
	}
	var selecttext=$("select[name='curAddrCounty1']").find("option:selected").text(); 
	$("input[name='curAddrCounty']").val(selecttext);
	$.post("applicationSingle/area",{selectId:selectId},function(data){
		var contenta="<option value='' selected>请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressStreet.length;i++){
				contenta+="<option value="+item.AddressStreet[i].streetid+">"
				+item.AddressStreet[i].street+"</option>"
			}
			$("select[name='curAddrStreet1']").html(contenta);		
		});
	},"json");
}
function changecounty1(){
	var selectId=$("select[name='contactAddrCounty1']").val();
	if(selectId==null || selectId==""){
		return false;
	}
	var selecttext=$("select[name='contactAddrCounty1']").find("option:selected").text(); 
	$("input[name='contactAddrCounty']").val(selecttext);
	$.post("applicationSingle/area",{selectId:selectId},function(data){
		var contenta="<option value='' selected>请选择</option>";
		var i;
		$(data).each(function(n,item){
                for(i=0;i<item.AddressStreet.length;i++){
				contenta+="<option value="+item.AddressStreet[i].streetid+">"
				+item.AddressStreet[i].street+"</option>"
			}
			$("select[name='contactAddrStreet1']").html(contenta);
		
		});
	},"json");
}
function changestreet(){
	var selecttext=$("select[name='curAddrStreet1']").find("option:selected").text(); 
	$("input[name='curAddrStreet']").val(selecttext);
}
function changestreet1(){
	var selecttext=$("select[name='contactAddrStreet1']").find("option:selected").text(); 
	$("input[name='contactAddrStreet']").val(selecttext);
}

function sendMessageCode(){
	var mobile=$("input[name='mobile']").val();
	$.post("personalInfo/sendMessage",{mobile:mobile},function(json){
		if(json.code==0){
			alertMsg.correct(json.msg);
			$("#submitByUpdatePersonal").removeAttr("disabled");
		}else{
			alertMsg.warn(json.msg);
		}
		
	},"json");
}
</script>
<div class="pageContent">
	<form method="post" action="personalInfo/commitPersonalInfo"class="pageForm"
		onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<fieldset>
				<legend>个人信息</legend>
				<!--  <div Style="width: 100%;">
					<div id="photo" style="float: right;padding-right:250px">
						
						<img  width="72" height="80" alt="查看图片" src="">
					</div>
				</div> -->
				<p>
					<label>姓名：</label> 
					<input  name="customerNo" type="hidden" value="" >
					<input  name="customerName"class="validRequired validName" type="text" size="10"  alt="" />
				</P>
				<p>
					<label>性别：</label> 
					<input  type="radio" name="gender"value="01" />男 
					<input  type="radio" name="gender"value="02" />女
				</P>

				<p>
					<label>民族：</label> 
					<select id="nationality" name="nationality"class="validRequired" >
					</select>
				</P>

				<p>
					<label>出生日期：</label> 
					<input id="birth" name="birth"type="text" size="30" class="validRequired" />
				</P>

				<p>
					<label>证件类型：</label> 
					<select flag="paperCode" id="paperTypeByUpdatePersonalReg" name="paperType" class="" >
					</select>
				</p>

				<p>
					<label>证件号码：</label> 
					<input  name="paperNo" type="text"size="30" class="" alt="" />
				</P>
				<!-- <input name="formSeriData" type="hidden"> -->
			</fieldset>

			<fieldset>
				<legend>户籍信息</legend>
				<p>
					<label>户籍所在省份：</label> 
					<select class=""  name="prAddrProvince1" onchange="changepro()">				
					</select>
					<input  name="prAddrProvince" type="hidden" value="" >
				</p>
				<p>
					<!-- 户籍地址市-->
					
					<label>户籍所在市：</label> 
					<select class="" name="prAddrCity1" name="prAddrProvince1" onchange="changecitys()">	
					<option value="">请选择</option> 
					</select>
					<input  name="prAddrCity" type="hidden" value="" >
				</p>
			</fieldset>
			<fieldset>
				<legend>现居住地信息</legend>
				<p>
					<label>省：</label> 
					<select class=""  name="curAddrProvince1" onchange="changepro1()">
					</select>
					<input  name="curAddrProvince" type="hidden" value="" >
				</p>
				<p>
				<label>市：</label> 
					<select class=""  name="curAddrCity1" onchange="changecity()">				
						<option value="">请选择</option>
					</select>
					<input  name="curAddrCity" type="hidden" value="" >
				</p>
				<p>
				<label>区/县：</label> 
				<select class=""  name="curAddrCounty1" onchange="changecounty()">					
						<option value="">请选择</option>
				</select>
				<input  name="curAddrCounty" type="hidden" value="" >
				</p>
				<p>
				<label>街道/镇：</label> 
				<select class=""  name="curAddrStreet1" onchange="changestreet()">				
						<option value="">请选择</option>
				</select>
				<input name="curAddrStreet" type="hidden" value="" >
				</p>
				<p>
					<label>详细地址：</label> 
					<input id="add" name="curAddrDetailedInfo" type="text" size="30" maxlength="30" alt="" />
				</P>
			</fieldset>
			<fieldset>
				<legend>通讯地址信息：</legend>
				<p>
				<label>省：</label> 
				<select class="" name="contactAddrProvince1" onchange="changepro2()">	
				</select>
					<input  name="contactAddrProvince" type="hidden" value="" >
				</p>
				<p>
				<label>市：</label> 
				<select class="" name="contactAddrCity1"  onchange="changecity1()">				
						<option value="">请选择</option>
				</select>
				<input name="contactAddrCity" type="hidden" value="" >
				</p>
				<p>
				<label>区/县：</label> 
				<select class=""  name="contactAddrCounty1" onchange="changecounty1()">			
						<option value="">请选择</option>
				</select>
				<input  name="contactAddrCounty" type="hidden" value="" >
				</p>
				<p>
				<label>街道/镇：</label> 
				<select class="" name="contactAddrStreet1" onchange="changestreet1()">					
						<option value="">请选择</option>
				</select>
				<input name="contactAddrStreet" type="hidden" value="" >
				</p>
				<p>
				<label>详细地址：</label> 
				<input name="contactAddrDetailedInfo"type="text" size="30"  maxlength="30" alt="" />
				</P>

				<p>
				<label>固定电话：</label> 
				<input  name="homePhone"type="text" size="15"  alt="" class="validTelePhone"/>
				</P>
				
				<p>
				<label>邮政编码：</label> 
				<input  name="contactPostalcode" type="text" size="15" class="validPostCode"/>
				</P>

				<p>
				<label>电子邮箱：</label> 
				<input  name="email"type="text" size="20" class="validEmail"/>
				</P>
				<p>
				<label>联系电话(手机)：</label> 
				<input  name="mobile" type="text" size="15"  maxlength="11" class="validRequired validMobile"/>
				<input type="button" class="newButton" onclick="sendMessageCode()" value="发送短信">
				</P>
				<p>
				<label>验证码：</label> 
				<input  name="code"type="text" size="20" class=""/>
				</P>
			</fieldset>
			<div class="formBar">
				<ul>
					<!-- <li>
						 <div class="buttonActive">
							<div class="buttonContent">
							<a id="takePhotoIndex" class="" href="" target="dialog" rel="takePhotoIndex" title="拍照" width="700" height="400">
								<button type="button">拍照</button></a>
							</div>
						</div>
					</li> -->
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button id="submitByUpdatePersonal" type="submit" class="valid">提交</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
			</div>
	</form>
</div>